module.exports = {
  success: (res, data, message = '操作成功', code = 200) => {
    res.status(code).json({
      code,
      message,
      data
    });
  },
  
  error: (res, message = '操作失败', code = 400) => {
    res.status(code).json({
      code,
      message,
      data: null
    });
  },
  
  notFound: (res, message = '资源不存在') => {
    res.status(404).json({
      code: 404,
      message,
      data: null
    });
  },
  
  unauthorized: (res, message = '未授权') => {
    res.status(401).json({
      code: 401,
      message,
      data: null
    });
  },
  
  forbidden: (res, message = '无权限') => {
    res.status(403).json({
      code: 403,
      message,
      data: null
    });
  }
};